<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 得到当前的时间戳
        const now = +new Date()
        //得到将来的时间戳
        const last = +new Date('2023-12-1 18:30:00')
        //得到剩余的时间戳 转换为秒数
        const count = (last - now) / 1000
        let D = parseInt(count / 60 / 60 / 24)
        let h = parseInt(count / 60 / 60 % 24)
        let m = parseInt(count / 60 % 60)
        let s = parseInt(count % 60)
        console.log(D, h, m, s);

    </script>
</body>

</html>